package com.example.demo.controller;

import com.example.demo.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.annotation.Secured;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
public class TestController {

    @Autowired
    FileService fileService;

    @GetMapping("/test")
    public String getTest(){
        return "hello";
    }

    @GetMapping("/getFile")
    public void getFile1(HttpServletRequest request, HttpServletResponse response)throws Exception{
        String filename = "成都信息工程大学本科学位论文模板.doc";
        String path = "files/成都信息工程大学本科学位论文模板.doc";
        fileService.GetFile(filename,path,response);
    }
}
